# -*- coding:utf-8 -*-
# @FileName  :dhcc_ent_workday.py
# @Time      :2020/12/9 20:42
# @Author    :Zhoujirong
# @Desc      :企业工作日管理
import parameterized
import datetime
from biz.flow.ent_workday import EntWorkDayRequest
from common.log import Log
from common.params_operator import Param
from biz.cases.base_case import BaseCase

class TestEntWorkday(BaseCase):
    @classmethod
    def setUpClass(cls):
        cls.cookie = BaseCase().get_token()


    def test_1_get_month(self):
        '''获取本月修改后的日期'''
        year = datetime.date.today().year
        month = datetime.date.today().month
        ret = EntWorkDayRequest.get_month(year,month,self.cookie)
        Log.info(ret)
        self.assertEqual([],ret)

    @parameterized.parameterized.expand(Param.from_excel('work_day.xls'))
    def test_save_day(self,ymd,isWorkDay,check,desc):
        self._testMethodDoc = desc
        ret = EntWorkDayRequest.save_day(ymd,isWorkDay,self.cookie)
        Log.info(ret)
        self.assertEqual(check,ret.code)

    def test_2_save_day(self):
        '''休息日变工作日'''
        ymd = '2020-12-12'
        isWorkDay = 1
        ret = EntWorkDayRequest.save_day(ymd,isWorkDay,self.cookie)
        Log.info(ret)
        self.assertEqual('00000000', ret.code)

    def test_3_save_day(self):
        '''工作日变休息日'''
        ymd = '2020-12-14'
        isWorkDay = 0
        ret = EntWorkDayRequest.save_day(ymd,isWorkDay,self.cookie)
        Log.info(ret)
        self.assertEqual('00000000', ret.code)

    def test_4_get_month(self):
        '''获取本月修改后的日期2条'''
        year = '2020'
        month = '12'
        ret = EntWorkDayRequest.get_month(year,month,self.cookie)
        Log.info(ret)
        self.assertEqual(2,len(ret))

    def test_5_save_day(self):
        '''休息日变正常'''
        ymd = '2020-12-12'
        isWorkDay = 0
        ret = EntWorkDayRequest.save_day(ymd,isWorkDay,self.cookie)
        Log.info(ret)
        self.assertEqual('00000000', ret.code)

    def test_6_save_day(self):
        '''工作日变正常'''
        ymd = '2020-12-14'
        isWorkDay = 1
        ret = EntWorkDayRequest.save_day(ymd,isWorkDay,self.cookie)
        Log.info(ret)
        self.assertEqual('00000000', ret.code)

    def test_7_get_month(self):
        '''获取本月修改后的日期0条'''
        year = '2020'
        month = '12'
        ret = EntWorkDayRequest.get_month(year,month,self.cookie)
        Log.info(ret)
        self.assertEqual(0,len(ret))






if __name__ == "__main__":
    pass